﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Besture.Bll;
using Besture.Common;
using Besture.Model;

namespace Besture.UI.Portal.Master
{
    public partial class Portal : System.Web.UI.MasterPage
    {
        public string UserName = string.Empty;
        /// <summary>
        /// 用户信息
        /// </summary>
        protected UserBaseModel LoginUserInfo
        {
            get { return HttpContext.Current.Session[Constants.SESSION_WEB_USER_MODEL] == null ? null : (UserBaseModel)HttpContext.Current.Session[Constants.SESSION_WEB_USER_MODEL]; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //绑定友情链接
                var dt = QueryDac.GetTable(string.Format(@"
                SELECT * FROM dbo.TBPartContent pc
                WHERE pc.PartID=133 AND pc.IsDisplay=1
                ORDER BY pc.SortID ASC "));
                repLinks.DataSource = dt;
                repLinks.DataBind();
            }
        }
        /// <summary>
        /// 退出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Exit(object sender, EventArgs e)
        {
            Session[Constants.SESSION_WEB_USER_MODEL] = null;
            Response.Redirect("/Portal/UserCenter/Login.aspx");
        }
    }
}